package com.xneure.enging.widget.tree;

import com.xneure.enging.ui.element.tree.UiTree;
import com.xneure.enging.widget.Control;
import com.xneure.enging.widget.Widget;
import com.xneure.utils.ObjectUtil;

public class Tree extends Widget<UiTree> {
	private transient TreeItem ti;

	public Tree(Control parent) {
		super(parent);
	}

	@Override
	public void addElement(Control elem) {
		addTreeItem((TreeItem) elem);
	}

	public void addTreeItem(TreeItem elem) {
		if (ObjectUtil.isNotNull(ti)) {
			ti.setProperty("isLast", false);
		}
		elem.setProperty("isLast", true);
		super.addElement(elem);
		ti = elem;
	}
}
